package org.dromara.system.config;


import org.dromara.system.cache.SysDictDataEntityCache;
import org.dromara.system.service.ISysDictDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.StringRedisTemplate;

@Configuration
public class SystemCacheConfig {

    @Autowired
    StringRedisTemplate redisTemplate;

    @Value("${vcloud.redis.high.sysCheckLoad:true}")
    Boolean checkLoad;

    @Autowired
    ISysDictDataService sysDictDataService;

    @Bean
    public SysDictDataEntityCache systemDictDataEntityCache() {
        SysDictDataEntityCache cache = new SysDictDataEntityCache(checkLoad);
        cache.setRedisHighTemplate(redisTemplate);
        cache.setName("sysDictDataEntityCache");
        cache.setSysDictDataService(sysDictDataService);
        cache.init();
        return cache;
    }

}
